# # author：chaochao
# # finish_time 2021-07-13

# # 作业一
# # 用户密码复杂度验证

# # func1检测密码长度
# def func1(password,score):
#     if len(password) < 8:
#         advice.append("您的密码长度不足9个,容易被菜刀哦。")
#     else:
#         score += 1
#     return score
# # func2检测密码的类型
# lst = [0,0,0,0]
# def func2(password):
#     for i in password:
#         if sum(lst) >= 3:
#             break
#         else:
#             if i.isupper():
#                 lst[0] = 1
#             elif i.islower():
#                 lst[1] = 1
#             elif i.isdigit():
#                 lst[2] = 1
#             else:
#                 lst[3] = 1
#     return lst
# # func3判断密码是否重复
# def func3():
#     global score1
#     score1 = 0
#     for j in range(len(password)):
#         if password.count(password[j:j+3]) >= 2:
#             advice.append("您输入的密码包含了长度大于或等于3的字串重复！")
#             break
#         else:
#             score1 += 1
#     return score1
#
# print("保护隐私，人人有责！\n欢迎使用密码安全检测系统!")
# password = input("请输入您的密码:")
# score = 2
# advice = []
# score = func1(password,score)
# score1 = func3()
# if score1 == 1:
#     score += 1
# lst1 = func2(password)
# if sum(lst1) < 3:
#     info = ["你的密码需要包括大、小写字母.数字.其它符号,以上四种至少三种"]
#     print(score, advice+info)
# else:
#     score += 1
#     print(f"您的密码等级为{score}",advice)

# # 作业二：购物系统（recharge函数未执行成功）
# wel = "欢迎光临超好吃超好用超超网络购物商城！"
# print(wel.center(40,"*"))
# system_user = {"TaylorSwift":"5201314","Lina":5201314,"chaochao":"5201314"}
# goods = {"F0001":"1989","F0002":"网球拍","F0003":"茶颜悦色"}
# price = {"F0001":520,"F0002":1314,"F0003":16}
# shopping_car = {}
# # login()进行用户登录验证
# def login():
#     while True:
#         user_sys = (username,password)
#         if user_sys in system_user.items():
#             print("----------------------------------")
#             print("尊敬的VIP顾客您好，欢迎您购物，有任何问题请联系123，退出请输入\033[0;31;40m exit\033[0m ！")
#             print("----------------------------------")
#             return True
#         else:
#             print("***********************************")
#             print("*您的用户名或密码错误，请确认后重新输入！*")
#             print("***********************************")
#             break

# # recharge（）进行预算管理
# def recharge(money):
#     # global money
#     # money = int(input("请预先充值您的金额："))
#     if money.isdigit():
#         print(f"**恭喜您成功充值{money}￥**。")
#     else:
#         print("你是输入有误，请输入数字。")

# # shop()进行购物,prices剩余的预算
# def shop(money):
#     while True:
#         global prices
#         prices = int(money)
#         shopping = input("查看商品请输入1;查看已购信息请输入2；购买商品请输入3。\n")
#         if shopping == "1":
#             for i,j in goods.items():
#                 print(f"商品编号{i}的商品是{j}，商品的单价是{price[i]}￥。")
#         elif shopping == "2":
#             if len(shopping_car) > 0:
#                 for i in shopping_car:
#                     prices -= shopping_car[i]
#                     print(f"您已经购买了{i}")
#                 print(f"您剩余预算{prices}")
#             else:
#                 print("您的购物车为空，请您选择心爱的商品！")
#         elif shopping == "3":
#             num = input("请输入你要购买的商品的编号：")
#             if num in goods.keys():
#                if int(money) >= price[num]:
#                    shopping_car[goods[num]] = price[num]
#                    print(f"您已成功购买{goods[num]}")
#                    continue
#                else:
#                    print("余额不足，请充值")
#             elif num == exit:
#                for i in shopping_car:
#                    print(f"已购买商品{i},余额{prices}")
#                break
#             else:
#                print("您输入的编号有误，请重新输入。")
#             continue
#         else:
#             print("您输入编号有误，请重新输入")
#
#
# while True:
#     username = input("请您输入您的上的用户名：")
#     password = input("请您输入购物卡上的密码：")
#     if login():
#         if username == "exit":
#             print("您已退出超超购物系统，欢迎下次光临！")
#         while True:
#             money1 = input("请预先充值您的金额：")
#             # 此处不知道为什么一直有问题
#             recharge(money1)
#             if money1 == "exit":
#                 print("您已退出超超购物系统，欢迎下次光临！")
#                 break
#             else:
#                 while True:
#                     num = 0
#                     shop(money1)






